/*
 * @Author: xiaosihan
 * @Date: 2021-04-22 00:30:58
 * @Last Modified by: xiaosihan
 * @Last Modified time: 2021-06-14 23:26:21
 */

import OrbitControls, { OrbitControlsProps } from "../OrbitControls/OrbitControls";

import { MapControls as MapControlsFactory } from "three/examples/jsm/controls/OrbitControls.js";
import React from "react";

export interface MapControlsProps extends OrbitControlsProps {
}

interface State { }

export default class MapControls extends OrbitControls<MapControlsProps> {
    constructor(props: MapControlsProps) {
        super(props);
    }

    declare controls: MapControlsFactory;

    // 创建控制器
    creatContorl() {
        const { renderer } = this.context;
        this.controls = new MapControlsFactory(this.beControlCamera, renderer.domElement); //轨道控制器
    }

    setControlsParame() {
        super.setControlsParame();
        const { screenSpacePanning = false } = this.props;
        Object.assign(this.controls, { screenSpacePanning });
    }

    getTitleText() {
        return (
            <>
                <span>{"地图控制器"}<br /></span>
                <span>{"<MapControls/>"}<br /></span>
            </>
        )
    }

}